#include <cstdio>
#include <algorithm>
using namespace std;

int right[1000000];
int left[1000000];

void link(int L,int R){
	right[L] = R; 
	left[R] = L;
}

int main()
{
	int n, m, kase = 0;
	while(scanf("%d%d",&n,&m) == 2){
		for(int i = 1; i <= n; i++){
			left[i] = i-1;
			right[i] = (i+1)%(n+1);
		}

		right[0] = 1;
		left[0] = n;
		int op, X, Y, inv = 0;
		
		while(m--){
			scanf("%d",&op);
			if(op == 4) inv = !inv;
			else {
				scanf("%d%d",&X,&Y);
				if(op == 3 && right[X])
			}
		}
	}

	return 0;
}
